<!--
 * @Author: 雷宇航
 * @Date: 2021-07-09 17:24:36
 * @LastEditTime: 2021-07-26 10:54:24
 * @LastEditors: 雷宇航
 * @Description: 
 * @FilePath: \icm-vue\src\views\hifar\business\BusBusinessSalebeforeActivityDetailList.vue
-->
<template>
  <!-- table区域-begin -->
  <div class="BusBusinessSalebeforeActivityDetailList">
    <a-tabs defaultActiveKey="1">
      <a-tab-pane tab="4、售前支持" key="1">
        <a-table
          ref="table"
          size="middle"
          :scroll="{ x: true }"
          bordered
          rowKey="id"
          :columns="SalebeforeColumns"
          :dataSource="saleBeforDataSource"
          :pagination="ipagination"
          :loading="loading"
          class="j-table-force-nowrap"
          @change="handleTableChange"
        >
          <template slot="htmlSlot" slot-scope="text">
            <div v-html="text"></div>
          </template>
          <template slot="imgSlot" slot-scope="text">
            <span v-if="!text" style="font-size: 12px; font-style: italic">无图片</span>
            <img
              v-else
              :src="getImgView(text)"
              height="25px"
              alt=""
              style="max-width: 80px; font-size: 12px; font-style: italic"
            />
          </template>
          <template slot="fileSlot" slot-scope="text">
            <span v-if="!text" style="font-size: 12px; font-style: italic">无文件</span>
            <a-button v-else :ghost="true" type="primary" icon="download" size="small" @click="downloadFile(text)">
              下载
            </a-button>
          </template>

          <span slot="action" slot-scope="text, record">
            <a @click="handleEdit(record)">编辑</a>
            <a-divider type="vertical" />
            <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
              <a style="color:red">删除</a>
            </a-popconfirm>
          </span>
        </a-table>
      </a-tab-pane>
    </a-tabs>
  </div>
</template>

<script>
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import { getAction } from '@api/manage'

export default {
  name: 'BusBusinessSalebeforeActivityDetailList',
  mixins: [JeecgListMixin],
  props: {
    mainId: {
      type: String,
      default: '',
      required: false,
    },
  },
  watch: {
    mainId: {
      immediate: true,
      handler(val) {
        if (!this.mainId) {
        } else {
          this.queryParam['opportunityId'] = val
          this.loadData()
        }
      },
    },
  },
  data() {
    return {
      description: '客户商机管理页面',
      disableMixinCreated: true,
      showChangeTable: false,
      // 表头
      SalebeforeColumns: [
        {
          title: '序号',
          dataIndex: '',
          key: 'rowIndex',
          width: 60,
          align: 'center',
          customRender: function (t, r, index) {
            return parseInt(index) + 1
          },
        },
        {
          title: '客户简称',
          align: 'center',
          dataIndex: 'opportunityName',
        },
        {
          title: '销售负责人',
          align: 'center',
          dataIndex: 'saleLeader',
        },
        {
          title: '分配售前',
          align: 'center',
          dataIndex: 'distributionSalebefore',
        },
        {
          title: '工作内容',
          align: 'center',
          dataIndex: 'applyWorkDesc',
        },
        {
          title: '完成状态',
          align: 'center',
          dataIndex: 'status_dictText',
        },
        {
          title: '期望日期',
          align: 'center',
          dataIndex: 'expectTime',
        },
        {
          title: '实际日期',
          align: 'center',
          dataIndex: 'actualTime',
        },
        {
          title: '工时',
          align: 'center',
          dataIndex: 'workHours',
        },
        {
          title: '支持总结',
          align: 'center',
          dataIndex: 'supportSummary',
        },
      ],
      url: {
        saleBeforList: '/bussiness/busSalebeforeActivity/list',
      },
      dictOptions: {
        stage: [],
        signPossibility: [],
        type: [],
        source: [],
      },
      superFieldList: [],
      saleBeforDataSource: [],
      ipagination:{
        current: 1,
        pageSize: 5,
        pageSizeOptions: ['5', '10', '15'],
        showTotal: (total, range) => {
          return range[0] + "-" + range[1] + " 共" + total + "条"
        },
        showQuickJumper: true,
        showSizeChanger: true,
        total: 0
      },
    }
  },
  methods: {
    loadData() {
      var param = Object.assign({}, this.queryParam)
      param.pageNo = this.ipagination.current
      param.pageSize = this.ipagination.pageSize
      param.opportunityId = this.mainId
      getAction(this.url.saleBeforList, param).then((res) => {
        if (res.success) {
          this.saleBeforDataSource = res.result.records
          this.ipagination.total = res.result.total;
        }
      })
    },
    handleTableChange(pagination) {
      this.ipagination = pagination
      this.loadData()
    },
  },
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>
<style>
.BusBusinessSalebeforeActivityDetailList .ant-table-placeholder {
  padding: 0;
}
.BusBusinessSalebeforeActivityDetailList .ant-empty-normal {
  margin: 15px 0;
}
</style>


